//
//  MYUnReadView.m
//  JQLive
//
//  Created by Bruce on 2020/3/31.
//  Copyright © 2020 JQLive. All rights reserved.
//

#import "MYUnReadView.h"

@implementation MYUnReadView


#pragma mark - Intial Methods
/**
 初始化数据
 */
- (void)initData
{
    
}

/**
 初始化试图
 */
- (void)initView
{
    [self setupViews];
}
- (void)setupViews
{
    _unReadLabel = [[UILabel alloc] init];
    _unReadLabel.text = @"0";
    _unReadLabel.font = [UIFont systemFontOfSize:10];
    _unReadLabel.textColor = [UIColor whiteColor];
    _unReadLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:_unReadLabel];
    [_unReadLabel mas_makeConstraints:^(MASConstraintMaker *make) {

        make.edges.equalTo(self).insets(UIEdgeInsetsMake(0, 2, 0, 2));
    }];

   
    self.backgroundColor = [UIColor redColor];
    self.hidden = YES;
}

#pragma mark - Network Methods

#pragma mark - Target Methods

#pragma mark - Public Methods

#pragma mark - Private Methods



#pragma mark - Lazy Loads

- (void)setNum:(NSInteger)num
{
    NSString *unReadStr = [[NSNumber numberWithInteger:num] stringValue];
    if (num > 99){
        unReadStr = @"99+";
    }
    _unReadLabel.text = unReadStr;
    self.hidden = (num == 0? YES: NO);
}


- (void)setCornerRadius:(CGFloat)cornerRadius
{
    _cornerRadius = cornerRadius;
    self.layer.cornerRadius = cornerRadius;
    [self.layer masksToBounds];
}

@end
